package com.huang.config;



import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Locale;

@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("index");
        registry.addViewController("/index.html").setViewName("index");

    }

/*
    @Override
    //添加一个拦截器
    public void addInterceptors(InterceptorRegistry registry) {
        //new一个自写的拦截器
        registry.addInterceptor(new LoginHandlerInterceptor())
                //添加拦截选项，全拦
                .addPathPatterns("/**")
                //除了部分页面,静态资源除外
                .excludePathPatterns("/index.html","/","/user/login","/css/**","/img/**","/js/**");
    }
*/

}
